package com.water.controller;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;

import java.beans.PropertyVetoException;
import java.util.Date;

/**
 * @author wsj
 * @version 1.0
 * @description: TODO
 * @date 2022/1/12 22:28
 */
public class JdbcController {

    public static void main(String[] args) throws PropertyVetoException {
        ComboPooledDataSource dataSource = new ComboPooledDataSource();
        dataSource.setDriverClass("com.mysql.cj.jdbc.Driver");
        dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/kaikeba?serverTimezone=UTC&characterEncoding=utf8&useUnicode=true&useSSL=false");
        dataSource.setPassword("root");
        dataSource.setUser("root");
        JdbcTemplate template = new JdbcTemplate(dataSource);
        String sql = "insert into eadmin(id,username,password) value (?,?,?)";
        int update = template.update(sql, 23,"water002", "123333");
        System.out.println("数据插入结果："+update);

    }

}
